<?php
/*
# ------------------------------------------------------------------------
# JA Job Board Package
# ------------------------------------------------------------------------
# Copyright (C) 2004-2010 JoomlArt.com. All Rights Reserved.
# @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
# Author: JoomlArt.com
# Websites: http://www.joomlart.com - http://www.joomlancers.com.
# ------------------------------------------------------------------------
*/

// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die();

jimport( 'joomla.application.component.view' );

class JAJobBoardViewJACredits extends JAView 
{
	/**
	 * Hellos view display method
	 * @return void
	 **/
	function display($tpl = null)
	{
		$task = JRequest::getVar("task", '');
		switch ($task){
			case 'add':
			case 'edit':				
				JAJobBoardViewJACredits::displayForm($tpl);
				break;			
			default:
				JAJobBoardViewJACredits::displayListItems($tpl);
		}		
	}
	
	/**
  	* Display List of items
  	*/
  	function displayListItems($tpl){  	
  		global $mainframe;

  		$lists = &$this->get('var');
		$total = &$this->get('countcredit');
		jimport('joomla.html.pagination');
		$pageNav = new JPagination( $total, $lists['limitstart'], $lists['limit'] );

		$items = &$this->get('Items');
		
		$this->assignRef('items', $items);
		$this->assignRef('lists', $lists);
		$this->assignRef('pageNav', $pageNav);

		parent::display($tpl);	
  	}
  	  		
	function displayForm($tpl)
	{
		global $option, $jbconfig;
		
		$cids = JRequest::getVar('cid',  0, '', 'array');
		$cid = (int)$cids[0];
		
		$row = $this->get('Item');
				
//		$str_units = explode(",", $jbconfig['general']->get('units', ''));
//		foreach ($str_units as $item){
//			$units[] = array('value'=>strtoupper(trim($item[0])), 'title' =>trim($item));
//		}
//		$selected_unit = $edit?$row->units:'M';	
//		$units = JHTML::_('select.genericlist',  $units, 'units', 'class="inputbox" size="1"','value','title', $selected_unit);
				
		$this->assign('row', $row);
		$this->assign('option', $option);
		$this->assign('config', $jbconfig);
//		$this->assign('units', $units);

		parent::display($tpl);
	}
}
